/*
day46
2019.10.13
*/
#include<stdlib.h>
#include<stdio.h>

struct ListNode {
    int val;
    struct ListNode *next;
};

struct ListNode* deleteDuplicates(struct ListNode* head)
{
	if(!head||!head->next)
	{
		return head;
	}
	
	struct ListNode *pre=(struct ListNode*)malloc(sizeof(struct ListNode));
	pre->next=head;
	
	struct ListNode *p=pre;
	while(p&&p->next&&p->next->next)
	{
		if(p->next->val==p->next->next->val)
		{
			while(p->next&&p->next->next&&p->next->val==p->next->next->val)
			{
				p->next->next=p->next->next->next;
			}
			p->next=p->next->next;
		}
		else
		{
			p=p->next;
		}	
	}
	return pre->next;
}

int main()
{ 
	return 0;
}
